

<%@ page import="george_foreman.Tournament" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'tournament.label', default: 'Tournament')}" />
        <title><g:message code="default.create.label" args="[entityName]" /></title>
        <script src="${resource(dir:'js',file:'jquery.js')}" type="text/javascript"></script>
        <script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.bgiframe.min.js"></script>
        <script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.dimensions.js"></script>
        <script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js"></script>
        <!--<script type="text/javascript">
            $(document).ready(function(){
                var prev_players="$(playerInstanceList)";
                var players="";
                for (player in prev_players){
                    players = players + player.name + " ";
                }
                data = players.split(" ");
                $(#entrants).autocomplete(data);
                for (player in data){
                    var ind=0;
                    for (player1 in prev_players){
                        if (player1.name.equals(player)){
                            ind++;
                            def e = new Entry(player:player1, tournament:$(tournamentInstance));
                            player1.addToTournaments(e);
                        }
                    }
                    if (ind==0){
                        def new_player= new Player(name:player)
                        def e = new Entry(player:new_player, tournament:$(tournamentInstance));
                        player.addToTournaments(e);
                        $(tournamentInstance).addToEntrants(e);
                    }
                }
            })
        </script>-->
    </head>
    <body>
        <div class="body">
            <h1><g:message code="default.create.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${tournamentInstance}">
            <div class="errors">
                <g:renderErrors bean="${tournamentInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" >
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="name"><g:message code="tournament.name.label" default="Name" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: tournamentInstance, field: 'name', 'errors')}">
                                    <g:textField name="name" value="${tournamentInstance?.name}" />
                                </td>
                            </tr>

                            <!--The 'entrants' entry box
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="entrants"><g:message code="tournament.entrants.label" default="Entrants" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: tournamentInstance, field: 'entrants', 'errors')}">
                                    <div id="entrants"><g:textField name="entrants" value="${tournamentInstance?.entrants}" /></div>
                                </td>
                            </tr>
                            -->
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
